﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace TexasHoldEmCroupier.Views
{
    public partial class PlayerDetailsWizardView : Form
    {
        #region Members
        private int _Index = 0;
        #endregion

        #region Properties
        public int Index
        {
            get { return this._Index; }
            set 
            {
                this._Index = value;

                this.Text = String.Format(
                    CultureInfo.CurrentCulture,
                    "Step 2 - Player {0} Details",
                    this._Index + 1);
            }
        }

        public string PlayerName
        {
            get { return this._textboxName.Text; }
            set { this._textboxName.Text = value; }
        }

        public decimal Account
        {
            get { return this._updownRaise.Value; }
            set { this._updownRaise.Value = value; }
        }

        public Button buttonExit
        {
            get { return this._buttonExit; }
        }
        
        public Button buttonPrevious
        {
            get { return this._buttonPrevious; }
        }

        public Button buttonNext
        {
            get { return this._buttonNext; }
        }
        #endregion

        #region Methods
        public PlayerDetailsWizardView(
            int thePlayerIndex)
        {
            InitializeComponent();

            this.Index = thePlayerIndex;

            this._textboxName.Focus();
        }
        
        public PlayerDetailsWizardView()
        {
            InitializeComponent();
        }

        #region Private Helpers
        public bool IsFormValid()
        {
            this._ErrorProvider.Clear();

            if (String.IsNullOrEmpty(this._textboxName.Text))
            {
                this._ErrorProvider.SetError(
                    this._textboxName,
                    "You must provide a name for this player");

                return false;
            }
            return true;
        }
        #endregion
        #endregion
    }
}
